import axios from 'axios'
import qs from 'qs'
let API_HOST = "http://www.zidianjob.top/tp5/public/index.php/"
// let API_HOST = "http://localhost/tp5/public/index.php/"
// 登录
function personal_login(user, psw) {
  var url = API_HOST + 'personallogin';
  const data = { 'user': user, 'psw': psw, };
  const options = {
    method: 'POST',
    data: qs.stringify(data),
    url,
  };
  return axios(options);
}

// token验证
function personal_token(id, token) {
  var url = API_HOST + 'personaltoken';
  const data = { 'id': id, 'token': token, };
  const options = {
    method: 'POST',
    data: qs.stringify(data),
    url,
  };
  return axios(options);
}

//个人注册
function personal_registration(user, psw) {
  var url = API_HOST + 'personalregistration';
  const data = { 'user': user, 'psw': psw, };
  const options = {
    method: 'POST',
    data: qs.stringify(data),
    url,
  };
  return axios(options);
}

// get_user_info
function get_user_info(id) {
  var url = API_HOST + 'getuserinfo';
  const data = { 'id': id };
  const options = {
    method: 'POST',
    data: qs.stringify(data),
    url,
  };
  return axios(options);
}

//resume_keeping
function resume_keeping(id, name, sex, age, address, tel, email, focus, arrival, area, wages, company, industry, SASTime, leaving,
  jobContent, school, education, major, function1, duration1, function2, duration2, function3, duration3, skill1, skill2, skill3) {
  var url = API_HOST + 'resumekeeping';
  const data = {
    'id': id, 'name': name, 'sex': sex, 'age': age, 'address': address, 'tel': tel,
    'email': email, 'focus': focus, 'arrival': arrival, 'area': area, 'wages': wages, 'company': company, 'industry': industry, 'SASTime': SASTime,
    'leaving': leaving, 'jobContent': jobContent, 'school': school, 'education': education, 'major': major,
    'function1': function1, 'duration1': duration1, 'function2': function2, 'duration2': duration2,
    'function3': function3, 'duration3': duration3, 'skill1': skill1, 'skill2': skill2, 'skill3': skill3,
  };
  const options = {
    method: 'POST',
    data: qs.stringify(data),
    url,
  };
  return axios(options);
}

export default {
  personal_login,
  personal_token,
  personal_registration,
  get_user_info,
  resume_keeping
}